<?php
$tab=(int)$_GET['tab'];
//$check = checkRed($options['teacher'],$openid);
//$t = checkTeacher($openid);
?>
<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
<title>家长首页</title>
<link rel="stylesheet" href="/skin/weui/weui.min.css"/>
<style>
body { background-color: #f8f8f8; }
.container, .page { position: absolute; top: 0; right: 0; bottom: 0; left: 0 }
.page__hd { padding: 30px; }
.page__title { text-align:center; font-size: 24px; font-weight: 400; color:#4ABB44; }
.page__desc { margin-top: 5px; color: #888; text-align: center; font-size: 14px; }
.weui-footer { margin-bottom: 40px; margin-top: 20px; }
</style>
</head>
<body>
<div class="page">
	<div class="page__bd" style="height: 100%;">
		<?php
		$bqno = 0;
		$sql=$empire->query(whereSQL($options['student'],0,'id,title,newstime,uidName,keMu,QRurl,QRkey')."openid='$openid' order by id DESC limit 200");
		while($r=$empire->fetch($sql))        //循环获取查询记录
		{
			++$bqno;
			$shangKeNum = shangKeNum(0,$r['id']);
			$chongZhiNum = chongZhiNum(0,$r['id']);
			$getStarNum = getStarNum(0,$r['id']);
			$zhuangTai = $getStarNum/($shangKeNum*5)*100;
		?>
		<div class="weui-cells">
            <div class="weui-cell">
                <div class="weui-cell__hd" style="position: relative;margin-right: 10px;">
                    <img src="images/user.jpg" style="width: 50px;display: block">
                </div>
                <div class="weui-cell__bd">
                    <p><?=$r['uidName']?> <small style="font-size: 12px;color: #888888;"></small></p>
                    <p style="font-size: 12px;color: #888888;"> <?=keMuTxt($r['keMu'])?> | <?=date("Y-m-d H:i:s",$r['newstime'])?></p>
                </div>
				<div class="weui-cell__ft">
				
					<!-- a href="javascript:;" class="weui-btn weui-btn_mini weui-btn_plain-primary yuYueButton">请假</a -->
				</div>
            </div>
            <div class="weui-cell" style="padding:10px 15px;">
                <div class="weui-cell__bd">
                	<p>课时进度</p>
				</div>
				<div class="weui-cell__ft" style="padding:0 10px;">
					<div class="weui-progress">
						<div class="weui-progress__bar">
							<div class="weui-progress__inner-bar js_progress" style="width: <?=$shangKeNum/$chongZhiNum*100?>%"></div>
						</div>
					</div>
					<small style="font-size: 10px;color: #888888;">(以上<?=$shangKeNum?>节,剩余<?=$chongZhiNum?>节) </small> 
                </div>
            </div>
            <div class="weui-cell" style="padding:10px 15px;">
                <div class="weui-cell__bd">
                	<p>上课状态</p>
				</div>
				<div class="weui-cell__ft" style="padding:0 10px;">
					<div class="weui-progress">
						<div class="weui-progress__bar">
							<div class="weui-progress__inner-bar js_progress" style="width: <?=$getStarNum/($shangKeNum*5)*100?>%"></div>
						</div>
					</div>
					<small style="font-size: 10px;color: #888888;">(应得<?=$shangKeNum*5?>星,实得<?=$getStarNum?>星) </small> 
                </div>
            </div>
			<?php
			
			$bqno1=0;
			$sql1=$empire->query(whereSQL($options['log2'],0,'id,title,newstime,tidName,num')."uid='$r[id]' order by id DESC limit 5");
			while($r1=$empire->fetch($sql1))        //循环获取查询记录
			{
				++$bqno1;
				?>
            <div class="weui-cell" style="padding:5px 15px;">
                <div class="weui-cell__bd">
                	<span style="vertical-align: middle"><small style="font-size: 12px;"><?=$bqno1?>. <?=date("Y-m-d H:i",$r1['newstime'])?></small> <small style="font-size: 12px;color: #888888;">星期<?=week(date("w",$r1['newstime']))?> | <?=$r1['tidName']?></small></span>
                   
                </div>
                <div class="weui-cell__ft" style="font-size: 14px;"><?=$r1['num']?>星</div>
            </div>
			<?php
			}
			if($bqno1)
			{
				?>
			<span id="list<?=$r['id']?>"></span>
			<div class="weui-panel__ft">
                <a href="javascript:void(0);" class="weui-cell weui-cell_access weui-cell_link Loadmore" data-uid="<?=$r['id']?>">
                    <div class="weui-cell__bd">查看更多</div>
                    <span class="weui-cell__ft"></span>
                </a>    
            </div>
				<?php
			}
			else
			{
				echo '<div class="weui-loadmore weui-loadmore_line"><span class="weui-loadmore__tips">暂时没有上课</span></div>';
			}
			?>
        </div>
		<?php
		}
		if(!$bqno)
		{
			echo '<div class="weui-loadmore weui-loadmore_line"><span class="weui-loadmore__tips">没有绑定</span></div>';
		}
		?>
				
	</div>
</div>

<script src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script> 
<script src="/skin/jquery/jquery.min.js"></script> 
<script src="/skin/jquery/ajaxECMS.js"></script> 
<script src="/skin/weui/weui.min.js"></script> 
<script src="../api.php?enews=getJsConfig"></script>
<script>
var page = 1;
$(function(){
	$(".Loadmore").click(function(e){
		e.preventDefault();
		var that = this;
		var uid = $(that).data("uid");
		var fromData = {enews:'shangKeList2',uid:uid,page:page,type:0};
		$.post("ecms.php",fromData,function(result){
			if(result)
			{
				++page;
				weui.toast('加载成功', 100);
				$("#list" + uid).show().html(result);
			}
			else
			{
				$(that).parent().hide();
				weui.toast('没有更多了', 2000);
			}
		});
	})
	$(".yuYueButton").click(function(){
		weui.alert("预约功能开发中....");
	})
})
wx.ready(function(){
});
</script>
</body>
</html>
